package com.weiwei.diancan.activity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.weiwei.diancan.R;
import com.weiwei.diancan.adapter.ShangpinAdapter;
import com.weiwei.diancan.base.BaseActivity;
import com.weiwei.diancan.bean.LoginBean;

import java.util.ArrayList;
import java.util.List;

public class ShangpinActivity extends BaseActivity {

    private RecyclerView recycler;
    private LoginBean.MenuListBean.DishListBean menu;
    private TextView tv_totle;

    @Override
    public void getData() {

        List<LoginBean.MenuListBean.DishListBean.SetListBean> list = menu.getSet_list();
        recycler.setAdapter(new ShangpinAdapter(list));
    }

    @Override
    public void setListeners() {

    }

    @Override
    public void initView() {
        recycler = (RecyclerView)findViewById(R.id.recycler);
        tv_totle = (TextView)findViewById(R.id.tv_totole);
        recycler.setLayoutManager(new LinearLayoutManager(this));
        recycler.setHasFixedSize(true);
    }

    @Override
    public void initTitle() {
        titler.setText(menu.getSet_name());
        iv_left.setVisibility(View.VISIBLE);
        iv_left.setText("返回");
        iv_left.setOnClickListener(v->finish());
    }

    @Override
    public void setLayoutView() {
        setContentView(R.layout.activity_shangpin);
        menu = ( LoginBean.MenuListBean.DishListBean)getIntent().getExtras().getSerializable("menu");
    }
}
